const {
  join
} = require('path')

const HTMLWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: "development",
  entry: "./src/index.ts",
  output: {
    path: join(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  devServer: {
    open: true
  },
  /* 
	支持import时不加.ts后缀
	extensions会覆盖默认后缀, 需要用...向webpack表示继承原先配置
  */
  resolve: {
    extensions: ['.ts', '...']
  },
  /* 打包ts的能力 */
  module: {
    rules: [{
      test: /\.ts$/,
      loader: 'ts-loader'
    }],
  },
  plugins: [
    new HTMLWebpackPlugin()
  ]
}